home *** CD-ROM | disk | FTP | other *** search
/ Aminet 13 / Aminet 13 - August 1996.iso / MainActor / Rexx / LoadMPEG_HAM8.ma < prev    next >
Text File  |  1996-07-09  |  4KB  |  137 lines

  1. /*                                                                        */
  2. /*  LoadMPEG_adpro.ma                                    Alex Kazik 1994  */
  3. /*  LoadMPEG_HAM6.ma                                                      */
  4. /*  LoadMPEG_HAM8.ma          Alle drei ARexx-Scripte sind zum laden von  */
  5. /*                    MPEG-Animationen. Das Script xxx_adpro konvertiert  */
  6. /*                     die Bilder mit hilfe von ADPro auf ein beliebiges  */
  7. /*   Format, dir Dither und Palette Option wird unterstützt. Dir Scripte  */
  8. /*      xxx_HAM* wandeln die Anim ohne ADPro in das HAM6/HAM8 format um.  */
  9. /*                                                                        */
  10. /*   Alle verwendeten Programme zur decodiering der MPEG-Anims sowie der  */
  11. /*   Konvertierung yuv2ppm und ppm2ilbm sind Public-Domain.               */
  12. /*                                                                        */
  13. /*                                                                        */
  14. /*   please read the .doc for english infomation                          */
  15.  
  16. OPTIONS RESULTS
  17.  
  18. address MAINACTOR
  19. printandstoretxt "ALX:MPEG Loader  -  by Alex Kazik 1994"
  20.  
  21. RequestFile "Select MPEG-File"
  22. IF RC = 10 THEN 
  23.   call xEXIT 1
  24. mpgfile = RESULT
  25.  
  26. if ( exists(mpgfile) = 0 ) then
  27.   call xexit 6
  28.  
  29. RequestSaveFile "Select Dest-File"
  30. IF RC = 10 THEN 
  31.   call xEXIT 1
  32. newname = RESULT
  33.  
  34. IF exists(newname) then do
  35.   printtxt "ALX:File already exists, replace?"
  36.   RequestSaveFile "Replace File -> select again!"
  37.   IF (RC = 10) | (RESULT ~= newname) then
  38.     call xexit 5
  39.   ADDRESS COMMAND 'delete' newname
  40. end
  41.  
  42. printtxt "ALX:Decoding MPEG..."
  43. ADDRESS COMMAND 'copy' mpgfile newname || '.mpg'
  44. wbtofront
  45. ADDRESS COMMAND 'MainActor:mpeg/mpeg -d' newname '>CON:'
  46. screentofront
  47. printtxt "ALX:Deleting TEMP."
  48. ADDRESS COMMAND 'delete' newname || '.mpg'
  49. pics=0
  50. picname = newname || pics
  51. if exists(picname || ".Y") = 0 then do
  52.   call xexit 2
  53. end
  54. if exists(picname || ".U") = 0 then do
  55.   call xexit 2
  56. end
  57. if exists(picname || ".V") = 0 then do
  58.   call xexit 2
  59. end
  60. pics=1
  61. picname = newname || pics
  62. if exists(picname || ".Y") = 0 then do
  63.   call xexit 7
  64. end
  65. if exists(picname || ".U") = 0 then do
  66.   call xexit 7
  67. end
  68. if exists(picname || ".V") = 0 then do
  69.   call xexit 7
  70. end
  71. xxx = 1
  72. do while xxx = 1
  73.   pics = pics + 1
  74.   picname = newname || pics
  75.   if exists(picname || ".Y") = 0 then
  76.     xxx = 0
  77.   if exists(picname || ".U") = 0 then
  78.     xxx = 0
  79.   if exists(picname || ".V") = 0 then
  80.     xxx = 0
  81. end
  82. printandstoretxt "ALX:Could find" pics "Pictures."
  83. RequestInteger 352 "Original picture-width of the MEPG"
  84. IF RC = 10 THEN 
  85.   call xEXIT 
  86. width=RESULT
  87. RequestInteger 240 "Original picture-height of the MPEG"
  88. IF RC = 10 THEN
  89.   call xEXIT 1
  90. height=RESULT
  91.  
  92. DO i=1 to pics                           
  93.   yuvpic = i - 1
  94.   yuvname = newname || yuvpic
  95.   actualpic=newname || "." || Right("00000" || i, 5)
  96.  
  97.   printtxt "ALX:Converting Pic" i || "/" || pics || ".  (YUV -> PPM)"
  98.   ADDRESS COMMAND 'MainActor:mpeg/cyuv2ppm' yuvname 'T:ppm.TEMP' '-iw' width '-ih' height
  99.   printtxt "ALX:Converting Pic" i || "/" || pics || ".  (PPM -> IFF)"
  100.   ADDRESS COMMAND 'MainActor:mpeg/ppmtoilbm >' || actualpic '-ham8 -hamFORCE' 'T:ppm.TEMP'
  101.   printtxt "ALX:Converting Pic" i || "/" || pics || ".  (deleting TEMP)"
  102.   ADDRESS COMMAND 'delete' yuvname || ".?"
  103. END
  104.  
  105. ADDRESS COMMAND 'delete t:ppm.TEMP'
  106.  
  107. ADDRESS MAINACTOR
  108. GetSPName
  109.  
  110. if (rc = 0) then
  111.   OpenNewProject                         
  112. SetSPLoader "PIC" "IFF"                
  113. LoadProject newname || ".00001" actualpic            
  114.  
  115. CALL xEXIT 0
  116.  
  117.  
  118.  
  119. xexit:
  120. ARG fehler
  121. if (fehler = 0) then
  122.   fehler = "Done."
  123. else if (fehler = 1) then
  124.   fehler = "Aborted!"
  125. else if (fehler = 2) then
  126.   fehler = "Error while decoding."
  127. else if (fehler = 5) then
  128.   fehler = "File already exists."
  129. else if (fehler = 6) then
  130.   fehler = "File don't exist."
  131. else if (fehler = 7) then
  132.   fehler = "Anim must have min. 2 Pics."
  133.  
  134. address MAINACTOR
  135. Screentofront
  136. PrintAndStoreTxt "ALX:" || fehler
  137. exit